package com.TestDemo.Test2;

public class A {

    public static void main(String[] args) {
        System.out.println(new B().getValue());
    }

    protected int value;
    public A (int v) {
        setValue(v);
    }
    public void setValue(int value) {
        this.value= value;
    }
    public int getValue() {

        try{
            setValue(value);
        }finally{
            System.out.println(value);
            return value;
        }
    }
}

class B extends A{
    public B(){
        super(5);
        setValue(getValue() - 3);
    }

    public void setValue(int value) {
        super.setValue(2 * value);
    }
}